﻿<%@ Page Language="C#" AutoEventWireup="false" CodeFile="recInvoiceInfoform.aspx.cs"
    Inherits="SIPO.Web.Forms.Transaction.recInvoiceInfoform" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Tagihan Form</title>

    <script src="<%= ResolveUrl("~/scripts/helper.js") %>" type="text/javascript"></script>
    <script src="<%= ResolveUrl("~/scripts/jquery.validate.min.js") %>" type="text/javascript"></script>
    <script src="<%= ResolveUrl("~/scripts/jquery.validate.wrapper.js") %>" type="text/javascript"></script>

    <%-- Jquery stuffs start --%>
    <link type="text/css" rel="stylesheet" href="<%= ResolveUrl("~/styles/ui.jqgrid.css") %>" />
    <script type="text/javascript" src="<%= ResolveUrl("~/scripts/i18n/grid.locale-id.js") %>"></script>
    <script type="text/javascript" src="<%= ResolveUrl("~/scripts/jquery.jqGrid.min.js") %>"></script>
    <script src="<%= ResolveUrl("~/scripts/jquery.inputmask.bundle.min.js") %>" type="text/javascript"></script>
    <script type="text/javascript">
        $("#btnClose").button({ icons: { primary: "ui-icon-close"} });
        $("#btnSave").button({ icons: { primary: "ui-icon-trash"} });

    </script>
    <script type="text/javascript">
        $(document).ready(function () {

            $("#lblTotalTagihan").inputmask("decimal", { radixPoint: ",", autoGroup: true, groupSeparator: ".", groupSize: 3, digits: 2, repeat: 18 });

            var statusdata = '<%= Request.Params["statusdata"] %>';
            if (statusdata == "delete") {
                $("#btnSave").show();
            }
            else {
                $("#btnSave").hide();
            }

            $("#btnSave").click(function () {

                var result = window.confirm('Benar data akan di hapus ?');
                if (result) {
                    var id = $('#<%= hfID.ClientID %>').val();

                    var objrecInvoice = new Object();
                    objrecInvoice.InvoiceNo = id;

                    jsonData = JSON.stringify(objrecInvoice);
                    var handlerUrl = '<%= ResolveUrl("~/ajaxhandler/Transaction/recInvoicehandler.ashx") %>';

                    CallAjax(handlerUrl, "?method=delete", jsonData);

                    parent.$('#dialog').dialog('close');

                    setTimeout("parent.$('#table').trigger('reloadGrid');", 3000);
                }

                return false;
            });

        });    


    </script>
    <script type="text/javascript">

        $('#btnClose').click(function () {
            parent.$('#dialog').dialog('close');
            return false;
        });
        
         
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <table border="0">
        <tr>
            <td style="width: 50">
               <b> No. Surat Tagihan </b>
            </td>
            <td>
               <b> : </b>
            </td>
            <td>
                <%-- <asp:TextBox ID="txtInvoiceNo" runat="server" Width="100"></asp:TextBox>--%>
                <asp:Label Font-Bold="true" ID="lblInvoiceNo" runat="server"></asp:Label>
            </td>
        </tr>
        <tr>
            <td style="width: 50">
               <b> Tgl. Surat Tagihan </b>
            </td>
            <td>
                <b>:</b>
            </td>
            <td>
                <%--<asp:TextBox ID="txtInvoiceDate" runat="server" Width="100"></asp:TextBox>--%>
                <asp:Label Font-Bold="true" ID="lblInvoiceDate" runat="server"></asp:Label>
            </td>
        </tr>
        <tr>
            <td style="width: 50">
                <b>Sektor</b>
            </td>
            <td>
               <b> : </b>
            </td>
            <td>
                <asp:Label Font-Bold="true" ID="lblSector" runat="server"></asp:Label>
            </td>
        </tr>
        <tr>
            <td style="width: 50">
               <b> Sub Sektor </b>
            </td>
            <td>
               <b> : </b>
             </td>
            <td>
                <asp:Label Font-Bold="true" ID="lblSubSektor" runat="server"></asp:Label>
            </td>
        </tr>
        <tr>
            <td style="width: 50">
               <b> Sub Sub Sektor </b>
            </td>
            <td>
               <b> : </b>
            </td>
            <td>
                <asp:Label Font-Bold="true" ID="lblSubSubSector" runat="server"></asp:Label>
            </td>
        </tr>
         <tr>
            <td style="width: 50">
             <b>   Total Tagihan </b>
            </td>
            <td>
               <b> : </b>
            </td>
            <td>
                <asp:Label Font-Bold="true" ID="lblTotalTagihan" runat="server"></asp:Label>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                &nbsp;
            </td>
            <td>
                <asp:HiddenField ID="hfID" runat="server" />
                <asp:HiddenField ID="hfInvoiceNo" runat="server" />
            </td>
        </tr>
    </table>
    <br />
    <table id="tableDetail" class="scroll" cellpadding="0" cellspacing="0">
    </table>
    <div id="pagerDetail" class="scroll">
    </div>
    <br />
    <div id="dialogDetail" title="Default dialog">
    </div>
    <script type="text/javascript">
        $(document).ready(function () {

            var InvoiceNo = $('#<%= hfID.ClientID %>').val();
            var handlerUrl = '<%= ResolveUrl("~/AjaxHandler/Transaction/recBillinghandler.ashx?method=getdatainfoinvoice") %>';

            $('#tableDetail').jqGrid({
                url: handlerUrl + "&InvoiceNo=" + InvoiceNo,
                datatype: 'json',
                colNames: ['ID', 'InvoiceNo', 'Jenis Tagihan', 'Keterangan', 'Jatuh Tempo', 'Nilai Tagihan'],
                colModel: [
                            { name: 'BillingNo', key: true, hidden: true, index: 'BillingNo', width: 60 },
                            { name: 'InvoiceNo', hidden: true, index: 'InvoiceNo', width: 60 },
           		            { name: 'recTransactionType.TransTypeName', index: 'recBilling.TransTypeID', width: 200, searchoptions: { sopt: ['eq', 'cn']} },
                            { name: 'ForPayment', index: 'ForPayment', align: 'left', width: 200, searchoptions: { sopt: ['eq', 'cn']} },
                            { name: 'DueDate', index: 'DueDate', align: 'center', width: 100, searchoptions: { sopt: ['eq', 'cn'] }, formatter: 'date', formatoptions: { newformat: 'd M Y'} },
                            { name: 'Value', index: 'Value', formatter: 'currency', align: 'right', formatoptions: { decimalSeparator: ".", thousandsSeparator: ",", decimalPlaces: 2 }, width: 150, searchoptions: { sopt: ['eq', 'cn']} }
           	            ],
                rowNum: 10,
                id: 'BillingNo',
                multiselect: false,
                rowList: [5, 10, 15, 20],
                pager: '#pagerDetail',
                sortname: 'recBilling.InvoiceNo',
                sortorder: "asc",
                viewrecords: true,
                jsonReader: { repeatitems: false },
                width: 800,
                height: '100%',
                caption: 'Tagihan',
                ajaxGridOptions: { cache: false }

            });

            $("#tableDetail").jqGrid('navGrid', '#pagerDetail', { edit: false, add: false, del: false, searchtext: 'Search', refreshtext: 'Refresh' },
                    {}, {}, {}, { closeOnEscape: true, multipleSearch: true, closeAfterSearch: true });



        });
    </script>
    <div>
        <div style="text-align: right; padding-top: 10px;">
            <button id="btnSave" type="button">
                Delete</button>
            <button id="btnClose" type="button">
                Close</button>
        </div>
    </div>
    </form>
</body>
</html>
